//
//  B_SwitchCell.m
//  Estate
//
//  Created by heyong on 16/6/8.
//  Copyright © 2016年 ttsx. All rights reserved.
//

#import "B_SwitchCell.h"

@implementation B_SwitchCell

- (void)setIsEdit:(BOOL)isEdit{
    if(isEdit){
        self.kaiguan.userInteractionEnabled=YES;
    }else{
        self.kaiguan.userInteractionEnabled=NO;
    }
}

- (void)setPersinal:(NSString *)persinal{
    if([persinal isEqualToString:@"setting"]){
        self.kaiguan.onTintColor=[UIColor colorWithRed:0.09 green:0.59 blue:0.54 alpha:1.00];
        self.kaiguan.thumbTintColor=[UIColor colorWithRed:0.77 green:0.77 blue:0.78 alpha:1.00];
        self.title.font=[UIFont systemFontOfSize:14*BIZ];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self. selectionStyle=UITableViewCellSelectionStyleNone;
    self.title.textColor=UIColorFromRGB(0x797979);
    self.kaiguan.transform=CGAffineTransformMakeScale(0.75, 0.75);
    
}

//设置分割线
- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); CGContextFillRect(context, rect);
    //    //上分割线，
    //    CGContextSetStrokeColorWithColor(context, [UIColor grayColor].CGColor); CGContextStrokeRect(context, CGRectMake(0, -1, rect.size.width , 1));
    //下分割线
    CGContextSetStrokeColorWithColor(context,[UIColor colorWithRed:0.89 green:0.89 blue:0.90 alpha:1.00].CGColor);
    CGContextStrokeRect(context, CGRectMake(0, rect.size.height, rect.size.width, 1));
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)swichChange:(UISwitch *)sender {
    if(self.sValueChangeBlock){
        self.sValueChangeBlock(sender);
    }
}
@end
